package com.ficus.road.maintain.core.model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;

/**
 * 失败的第三方请求
 * @author lijiawei
 * @date 2023/10/8 下午3:17
 */


@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@Builder
@AllArgsConstructor
public class FailedThirdRequest {

    @Id
    private String id;

    private Long firstRequestTime;

    private Integer retryTime;

    private String type;

    public FailedThirdRequest() {
        this.firstRequestTime = System.currentTimeMillis();
        this.retryTime = 0;
        this.type = getTypeName();
    }

    protected String generateRequestId() {
        return "defaultId";
    }

    protected String getTypeName() {
        return "defaultTypeName";
    }

}
